package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.ReportEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

/**
 * Author wyy
 * Date 2021/1/17 16:27
 **/
@Getter
@Setter
public class ReportQueryObject extends QueryObject{
    Long businessId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    Date endTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    Date startTime;
    //结算单状态
    Long status;
    Boolean ifOrder;
    String groupType= ReportEnum.BUSINESS.getValue();

    public Date getEndTime(){
        //糊涂工具
        if(endTime!=null){
            return DateUtil.endOfDay(endTime);
        }
        return null;

//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(endTime);
//
//        calendar.set(Calendar.HOUR_OF_DAY,23);
//        calendar.set(Calendar.MINUTE,59);
//        calendar.set(Calendar.SECOND,59);
//
//        return calendar.getTime();
    }
}
